import java.util.List;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;


public class LinkedListTest {

  public static void main(String[] args) {

    List<String> staff = new LinkedList<>();
    staff.add("Amy");
    staff.add("Bob");
    staff.add("Carl");

    Iterator<String> iterator = staff.iterator();

    iterator.next();
    iterator.next();
    iterator.remove();    // Remove last visited element. "Bob".

    ListIterator<String> iter = staff.listIterator();
    iter.next();
    iter.add("Ali");      // Add "Ali" after "Amy".
    iter.add("Juliet");   // Add "Juliet" after "Ali".

    for (String element : staff) {
      System.out.println(element);
    }
  }
}
